<template>
  <div class="user-info">
    <div class="avatar">
      <img src="../../../assets/img/profile/avatar.svg" alt="">
    </div>
    <div class="info">
      <div class="login" v-if="!userInfo.name">登录</div>
      <div class="phone">
        <img src="../../../assets/img/profile/phone.svg" alt="">
        <span>{{userInfo.name ? userInfo.name : '暂无绑定手机号,去登录'}}</span>
      </div>
    </div>
    <div class="more" @click="GoLogin">
      <img src="../../../assets/img/common/arrow-left.svg" alt="">
    </div>
  </div>
</template>

<script>
import {mapState} from 'vuex'
export default {
  name: 'UserInfo',
  data() {
    return {
      
    }
  },
  mounted() {
    
  },
  computed: mapState([
      'userInfo'
    ])
  ,
  methods: {
    GoLogin: function () {
      this.$router.replace('/login')
    }
  }
}
</script>

<style scoped>
  .user-info {
    position: relative;
    display: flex;
    height: 85px;
    padding: 6px 15px;
    background: coral;
  }
  .avatar img {
    width: 70px;
    height: 70px;
  }
  .info {
    flex: 1;
    padding-left: 15px ;
  }
  .info .login {
    padding-top : 15px;
  }
  .info .phone {
    height: 30px;
    line-height: 30px;
    font-size : 13px;
  }
  .info img {
    width: 20px;
    height: 30px;
    vertical-align: middle;
    margin-left: -5px;
  }
  .more {
    width: 20px;
    line-height: 85px;
  }
  .more img {
    width: 20px;
  }
</style>
